package com.recharge.web.controller;


import com.recharge.common.domain.PageDO;
import com.recharge.common.result.ResultDO;
import com.recharge.common.result.web.ObjectResponse;
import com.recharge.domain.query.UserOperationLogqueryDO;
import com.recharge.service.UserOperationLogService;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户操作日志 前端控制器
 * </p>
 *
 * @author reagan
 * @since 2020-08-19
 */
@RestController
@RequestMapping("/user-operation-log")
public class UserOperationLogController {

    @Autowired
    UserOperationLogService userOperationLogService;

    @RequiresPermissions("user-operation-log:page")
    @RequestMapping(value="/page.html", method = RequestMethod.POST)
    @ApiOperation(value = "查询操作日志")
    public @ResponseBody
    ObjectResponse get(@RequestBody UserOperationLogqueryDO domain) {
        ObjectResponse response = new ObjectResponse();

        ResultDO result = userOperationLogService.find(domain);
        if (result.isSuccess()) {
            response.setData((PageDO)result.getModel(ResultDO.FIRST_MODEL_KEY));
        } else {
            response.setStatus(result.getErrorCode().getCode());
            response.setMsg(result.getErrorCode().getMsg());
        }
        return response;
    }

}
